<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>{{ env('APP_NAME') }}-配置页面</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="{{ asset('bootstrap/css/bootstrap.min.css') }}">
    <!-- Font Awesome -->
    <link href="//cdn.bootcss.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet">
{{--<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">--}}
<!-- Ionicons -->
    <link href="//cdn.bootcss.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet">
{{--<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">--}}
<!-- Theme style -->
    <link rel="stylesheet" href="{{ asset('dist/css/AdminLTE.min.css') }}">
    <!-- iCheck -->

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        .input-box{
            display:none;

        }
        .button-display{
            padding-top:10px;
        }
        .form-group hr{
            border-color:rgba(112,123,222,0.4);
        }
        label span{
            color:red;
        }
    </style>
</head>
<body class="hold-transition login-page" >
<div class="login-box">
    <div class="login-logo">
        <a href="{{ action('Home\InitController@index') }}"><b>初始化配置</b></a>
    </div>
    <!-- /.login-logo -->
    <div class="login-box-body">
        <form action="{{ action('Home\InitController@index') }}" onsubmit="return false;" method="post">
            {{ csrf_field() }}

             {{--设置网站信息 --}}
            <div class="input-box" style="display:none;">
                <div class="form-group">
                    <label  class="control-label">网站名称</label>
                    <div>
                        <input type="text" name="APP_NAME" class="form-control" value="{{ env('APP_NAME') }}">
                    </div>
                </div>
            </div>

            {{-- 设置 是否上线 --}}
            <div class="input-box" style="display:none;">
                <div class="form-group">
                    <label  class="control-label">环境选择</label>
                    <div class="row">
                        <div class="col-md-offset-1 col-md-5">
                            开发环境: <input type="radio" name="APP_ENV" {{ env('APP_ENV')=='local'?'checked':'' }} value="local">
                            <input type="radio" name="APP_DEBUG" hidden  {{ env('APP_ENV')=='true'?'checked':'' }} value="true">
                        </div>
                        <div class="col-md-5">
                            上线: <input type="radio" name="APP_ENV" {{ env('APP_ENV')=='production'?'checked':'' }} value="production">
                            <input type="radio" name="APP_DEBUG" {{ env('APP_ENV')=='false'?'checked':'' }} hidden value="false">
                        </div>
                    </div>
                </div>
            </div>

            {{-- 设置 数据库信息 --}}
            <div class="input-box" style="display:none;">
                <div class="form-group">
                    <label  class="control-label">数据库类型 <span>*</span></label>
                    <div>
                        <input type="text" name="DB_CONNECTION" class="form-control" value="{{ env('DB_CONNECTION') }}">
                    </div>
                </div>
                <div class="form-group">
                    <label  class="control-label">数据库链接地址 <span>*</span></label>
                    <div>
                        <input type="text" name="DB_HOST" class="form-control" value="{{ env('DB_HOST') }}">
                    </div>
                </div>
                <div class="form-group">
                    <label  class="control-label">数据库端口 <span>*</span></label>
                    <div>
                        <input type="text" name="DB_PORT" class="form-control" value="{{ env('DB_PORT') }}">
                    </div>
                </div>
                <div class="form-group">
                    <label  class="control-label">数据库 库名 <span>*</span></label>
                    <div>
                        <input type="text" name="DB_DATABASE" class="form-control" value="{{ env('DB_DATABASE') }}">
                    </div>
                </div>
                <div class="form-group">
                    <label  class="control-label">数据库账号 <span>*</span></label>
                    <div>
                        <input type="text" name="DB_USERNAME" class="form-control" value="{{ env('DB_USERNAME') }}">
                    </div>
                </div>
                <div class="form-group">
                    <label  class="control-label">数据库密码 <span>*</span></label>
                    <div>
                        <input type="text" name="DB_PASSWORD" class="form-control" value="{{ env('DB_PASSWORD') }}">
                    </div>
                </div>
            </div>


            {{-- 设置 邮件信息 --}}
            <div class="input-box" style="display:none;">
                <div class="form-group">
                    <label  class="control-label">邮箱模式</label>
                    <div>
                        <input type="text" name="MAIL_DRIVER" class="form-control" value="{{ env('MAIL_DRIVER') }}">
                    </div>
                </div>
                <div class="form-group">
                    <label  class="control-label">邮箱域名</label>
                    <div>
                        <input type="text" name="MAIL_HOST" class="form-control" value="{{ env('MAIL_HOST') }}">
                    </div>
                </div>
                <div class="form-group">
                    <label  class="control-label">邮箱端口</label>
                    <div>
                        <input type="text" name="MAIL_PORT" class="form-control" value="{{ env('MAIL_PORT') }}">
                    </div>
                </div>
                <div class="form-group">
                    <label  class="control-label">邮箱账号</label>
                    <div>
                        <input type="text" name="MAIL_USERNAME" class="form-control" value="{{ env('MAIL_USERNAME') }}">
                    </div>
                </div>
                <div class="form-group">
                    <label  class="control-label">邮箱密码</label>
                    <div>
                        <input type="text" name="MAIL_PASSWORD" class="form-control" value="{{ env('MAIL_PASSWORD') }}">
                    </div>
                </div>
                <div class="form-group">
                    <label  class="control-label">邮箱地址</label>
                    <div>
                        <input type="text" name="MAIL_FROM_ADDRESS" class="form-control" value="{{ env('MAIL_FROM_ADDRESS') }}">
                    </div>
                </div>
                <div class="form-group">
                    <label  class="control-label">邮箱名</label>
                    <div>
                        <input type="text" name="MAIL_FROM_NAME" class="form-control" value="{{ env('MAIL_FROM_NAME') }}">
                    </div>
                </div>
            </div>

            {{--  设置 超级管理的 用户信息 --}}
            <div class="input-box" style="display:none;">
                <div class="form-group">
                    <label  class="control-label">姓名 <span>*</span></label>
                    <div>
                        <input type="text" name="ADMIN_NAME" class="form-control" value="{{ env('ADMIN_NAME') }}">
                    </div>
                </div>
                <div class="form-group">
                    <label  class="control-label">用户名 <span>*</span></label>
                    <div>
                        <input type="text" name="ADMIN_USER_NAME" class="form-control" value="{{ env('ADMIN_USER_NAME') }}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">密码 <span>*</span></label>
                    <div>
                        <input type="password" name="password" class="form-control" value="{{ env('ADMIN_PASSWORD') }}" placeholder="密码">
                    </div>
                </div>
            </div>
            <div class="row button-display">
                <div class="col-md-12 page">
                    <div class="col-xs-4 col-sm-4">
                        <button type="prev" class="btn btn-block">上一页</button>
                    </div>
                    <div class="col-xs-4 col-sm-4"> </div>
                    <div class="col-xs-4 col-sm-4">
                        <button type="next" class="btn btn-block">下一页</button>
                        <button type="submit" class="btn btn-primary btn-block btn-flat">提交</button>
                    </div>
                </div>
                {{--<div class="submit col-md-offset-8 col-xs-4" style="display:none;">--}}
                {{--</div>--}}
                <!-- /.col -->
            </div>
        </form>

        <!-- /.social-auth-links -->


    </div>
    <!-- /.login-box-body -->
</div>
<!-- /.login-box -->

<script src="{{ asset('app/jquery-2.2.3.min.js') }}"></script>
<script src="{{ asset('bootstrap/js/bootstrap.min.js') }}"></script>
{{--<!-- iCheck -->--}}
{{--<script src="../../plugins/iCheck/icheck.min.js"></script>--}}
<script>
    $(function(){
        function display_box(index){
            var input_boxs = $('.login-box-body .input-box');
            var input_box = $('.login-box-body .input-box:visible');
            var input_len = input_boxs.length - 1;
            var input_index = input_boxs.index(input_box);
            if(input_index < 0){
                input_index = 0;
            }
            input_index = input_index + index ;
            if(input_index > input_len  || input_index  < 0){
                return false;
            }
            input_boxs.hide().eq(input_index).show();
            if(input_index + 1 > input_len ){
                $('.button-display .page button[type=next]').hide();
                $('.button-display .page button[type=submit]').show();
            }else{
                $('.button-display .page button[type=next]').show();
                $('.button-display .page button[type=submit]').hide();
            }
            if(input_index -1 < 0){
                $('.button-display .page button[type=prev]').hide();
            }else{
                $('.button-display .page button[type=prev]').show();
            }
        }
        // 翻页 函数
        display_box(0);
        $('.button-display .page button[type=prev]').click(function(){
            display_box(-1);
        });
        $('.button-display .page button[type=next]').click(function(){
            display_box(1);
        });
        $('.button-display .page button[type=submit]').click(function(){
            $('.login-box-body form').attr('onsubmit','').submit();
        });
        $('input[name=APP_ENV]').click(function(){
            $(this).next().trigger('click')
        });

        $(document).keypress(function(e){
            if(e.key != 'Enter'){
                return true;
            }
            if($('.button-display .page button[type=submit]:visible').length){
                $('.button-display .page button[type=submit]:visible').trigger('click');
            }else{
                $('.button-display .page button[type=next]:visible').trigger('click');
            }
            return false;
//            return true;
        });
    })
</script>
</body>
</html>
